<template>
  <div>
    <navs title="点单记录" />
    <van-tabs v-model:active="active">
      <van-tab title="专家点单">
        <van-cell-group>
          <van-cell
            :title="item.expert.name"
            is-link
            size="large"
            v-for="(item, index) in data.expertList"
            :key="index"
          />
        </van-cell-group>
      </van-tab>
      <van-tab title="课程点单">
        <van-cell-group>
          <van-cell
            :title="item.course_name"
            is-link
            size="large"
            v-for="(item, index) in data.courseList"
            :key="index"
          />
        </van-cell-group>
      </van-tab>
    </van-tabs>
  </div>
</template>

<script setup>
import { ref, reactive, getCurrentInstance, onBeforeMount } from 'vue'

const instance = getCurrentInstance()
const _this = instance.appContext.config.globalProperties
const list = ref([])
const active = ref(0) //基地标签索引
const data = reactive({
  expertList: [],
  courseList: []
})
onBeforeMount(async () => {
  let expert_res = await _this.$api.user.getMyExpertOrder()
  data.expertList = expert_res.data
  let course_res = await _this.$api.user.getMyCourseOrder()
  data.courseList = course_res.data
})
</script>

<style scoped lang="scss"></style>
